#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <set>
#include <queue>

using namespace std;
using LL = long long;
using PII = pair<int, int>;
const int M = 4e5 + 10, N = M * 2;

int n, m, k;
int p[N];
int cnt;
vector<PII> seg;
vector<int> v[N];
unordered_map<int, bool> mp;
vector<int> dest;
vector<int> ans;

int find(int x){
    if(x != p[x]){
        p[x] = find(p[x]);
    }
    return p[x];
}

void merge(int a, int b){
    int fa = find(a), fb = find(b);
    if(fa != fb){
        p[fa] = fb;
        cnt --;
    }
}

int main(){
#ifdef LOCALFLAG
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif


    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> m;
    cnt = n;
    for(int i = 1; i <= n; i ++) p[i] = i;

    int x, y;
    for(int i = 0; i < m; i ++){
        cin >> x >> y;
        x ++, y ++;
        v[x].push_back(y), v[y].push_back(x);
        seg.push_back({x, y});
    }

    cin >> k;

    cnt -= k;

    for(int i = 0; i < k; i ++){
        cin >> x;
        x ++;
        mp[x] = true;
        dest.push_back(x);
    }


    //反向建立并查集
    for(int i = 0; i < seg.size(); i ++){
        x = seg[i].first, y = seg[i].second;
        if(!mp[x] && !mp[y]){
          

            merge(x, y);
        }
    }

    ans.push_back(cnt);
    for(int i = k - 1; i >= 0; i --){
        x = dest[i];
        if(mp[x]){
            mp[x] = false;
            cnt ++;
        }
        for(int j = 0; j < v[x].size(); j ++){
            if(!mp[v[x][j]]) merge(x, v[x][j]);
        }

        ans.push_back(cnt);
    }

    reverse(ans.begin(), ans.end());

    for(int i = 0; i < ans.size(); i ++){
        cout << ans[i] << '\n';
    }
    return 0;
}